package com.honey.mybatis.generator.criteria;

import com.honey.compilation.java.AbstractJavaCompilation;
import com.honey.compilation.java.Field;
import com.honey.compilation.java.Method;
import com.honey.core.compiler.CompilationException;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.mybatis.generator.AbstractProduceJavaCompilation;
import com.honey.mybatis.generator.MybatisPlugin;
import com.honey.mybatis.generator.criteria.field.BetweenValueField;
import com.honey.mybatis.generator.criteria.field.ConditionField;
import com.honey.mybatis.generator.criteria.field.EnumField;
import com.honey.mybatis.generator.criteria.field.ListValueField;
import com.honey.mybatis.generator.criteria.field.NoValueField;
import com.honey.mybatis.generator.criteria.field.SecondValueField;
import com.honey.mybatis.generator.criteria.field.SingleValueField;
import com.honey.mybatis.generator.criteria.field.TermField;
import com.honey.mybatis.generator.criteria.field.TypeHandlerField;
import com.honey.mybatis.generator.criteria.field.ValueField;
import com.honey.mybatis.generator.criteria.method.Criterion1Method;
import com.honey.mybatis.generator.criteria.method.Criterion2Method;
import com.honey.mybatis.generator.criteria.method.Criterion3Method;
import com.honey.mybatis.generator.criteria.method.Criterion4Method;
import com.honey.mybatis.generator.criteria.method.Criterion5Method;

public class ProduceCriterion extends AbstractProduceJavaCompilation {

	public ProduceCriterion(MybatisPlugin mybatisPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(mybatisPlugin, introspectSchema, introspectSchemaColumn);
		
	}

	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractProduceJavaCompilation#produceCompilation()
	 */
	@Override
	public AbstractJavaCompilation produceCompilation() throws CompilationException {
		return new CriterionClass().createJavaCompilation();
	}

	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractProduceJavaCompilation#produceFields()
	 */
	@Override
	public Field[] produceFields() throws CompilationException {
		Field[] answer = new Field[]{
			new EnumField().createField(),
			new TermField().createField(),
			new ConditionField().createField(),
			new ValueField().createField(),
			new SecondValueField().createField(),
			new NoValueField().createField(),
			new SingleValueField().createField(),
			new BetweenValueField().createField(),
			new ListValueField().createField(),
			new TypeHandlerField().createField(),
		};
		return answer;
	}

	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractProduceJavaCompilation#produceMethods()
	 */
	@Override
	public Method[] produceMethods() throws CompilationException {
		Method[] answer= new Method[]{
			new Criterion1Method().createMethod(),
			new Criterion2Method().createMethod(),	
			new Criterion3Method().createMethod(),
			new Criterion4Method().createMethod(),
			new Criterion5Method().createMethod(),
		};
		return answer;
	}

}
